/** @format */

/**
 *
 *  默认所用接口都会校验活动信息和用户信息
 *  不需要检查用户信息的使用noCheckUser装饰器 如：login  getActivityBaseInfoById
 *
 * @export
 * @param {*} target
 * @param {string} name
 * @param {PropertyDescriptor} descriptor
 */
export const noCheckUser = (target: any, name: string, descriptor: PropertyDescriptor) => {
  const method = descriptor.value
  descriptor.value = async function (...args: any[]) {
    const [context, otherArgs = {}] = args
    return method.apply(this, [context, { ...otherArgs, noCheckUser: true }])
  }
}

/**
 *
 *  默认所用接口都会校验活动信息和用户信息
 *  不需要检查用户信息的使用noCheckUser装饰器 如：login  getActivityBaseInfoById
 *
 * @export
 * @param {*} target
 * @param {string} name
 * @param {PropertyDescriptor} descriptor
 */
export const noCheckActivityInfo = (target: any, name: string, descriptor: PropertyDescriptor) => {
  const method = descriptor.value
  descriptor.value = async function (...args: any[]) {
    const [context, otherArgs = {}] = args
    return method.apply(this, [context, { ...otherArgs, noCheckActivity: true }])
  }
}
